package com.airconditioner.sales.activity;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ListView;

import com.airconditioner.sales.R;
import com.airconditioner.sales.adapter.GatherCalculateAdapter;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;

/**
 * 作者：shuizi_wade on 2017/2/8
 * 邮箱：674618016@qq.com
 */
@ContentView(R.layout.activity_gather_calculate)
public class GatherCalculateActivity extends BaseActivity {
    @ViewInject(R.id.lv_gather_calculate)
    ListView lv_gather_calculate;

    @Override
    public void init() {
        super.init();
        title_iv_back.setImageResource(R.mipmap.titlebar_back_black);
        title_iv_back.setBackgroundColor(getResources().getColor(R.color.white_color));
        title_relate_layout.setBackgroundColor(getResources().getColor(R.color.white_color));
        title_tv_title.setText(R.string.gather_cost);
        title_tv_right.setText(R.string.contract);
        View view = LayoutInflater.from(context).inflate(R.layout.activity_gather_calculate_footer, null);
        view.findViewById(R.id.relate_calulate_details).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jumpActvity(CalculateActivity.class);
            }
        });
        lv_gather_calculate.addFooterView(view);
        lv_gather_calculate.setAdapter(new GatherCalculateAdapter(context));
    }

    @Event({R.id.title_tv_right,R.id.title_iv_back})
    private void getEvent(View view) {
        switch (view.getId()) {
            case R.id.title_tv_right:
                jumpActvity(ContractActivity.class);
                break;
            case R.id.title_iv_back:
                finish();
                break;
        }
    }
}
